package com.network.chatsoft.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.network.chatsoft.entity.R;
import com.network.chatsoft.entity.UserEntity;
import com.network.chatsoft.service.UserService;
import org.apache.ibatis.annotations.Param;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.Map;

@RestController
public class UserController {

    @Autowired
    UserService userService;

    @PostMapping("/login")
    public R<UserEntity> login(@Param("username") String username, @Param("password") String password, HttpSession session){
        return userService.login(username,password,session);
    }

    @PostMapping("/regist")
    public R<String> regist(String username,String password){
        return userService.regist(username,password);
    }
}
